package com.lwt.service.serviceImpl;

import com.lwt.dao.base.dao.GradeDao;
import com.lwt.dao.base.dao.daoImpl.GradeImpl;
import com.lwt.pojo.Grade;
import com.lwt.service.GradeService;

import java.util.List;

/**
 * @Author Li Weitong
 * @Date 2020/11/22 15:41
 */
public class GradeServiceImpl implements GradeService {
    private GradeDao gradeDao = new GradeImpl();
    @Override
    public void addGrade(Grade grade) {
        gradeDao.addGradeInfo(grade);
    }

    @Override
    public int deleteGradeById(Integer gradeId) {
        int i = gradeDao.deleteGradeById(gradeId);
        if (i>0) {
            System.out.println("删除成功");
            return 1;
        }else {
            System.out.println("删除失败");
        }
        return -1;
    }

    @Override
    public int updateGrade(Grade grade) {
        int i = gradeDao.updateGrade(grade);
        if (i>0) {
            System.out.println("修改成功");
            return 1;
        }else {
            System.out.println("修改失败");
        }
        return -1;
    }

    @Override
    public List<Grade> queryGradeList() {
        return gradeDao.queryGradeList();
    }
}
